#!/usr/bin/env bash
osascript \
    -e 'tell application "Terminal"' \
    -e 'set position of front window to {1, 1}' \
    -e 'end tell'
opt1="Single URL"
opt2="Multiple URLs (File)"
webscreenshot=$(zenity  --list  --title "WebScreenShot" --radiolist  --column "" --column "" TRUE "$opt1" FALSE "$opt2" --height=400 --width=300)
case $webscreenshot in
$opt1 )
domain=$(zenity --entry --title "WebScreenShot" --text "Enter target URL")
mkdir ~/Documents/webscreenshot
cd ~/Documents/webscreenshot
webscreenshot -q 100 $domain
open ~/Documents/webscreenshot
exit;;
$opt2 )
zenity --info --text="Select a text file of URLs" --title="WebScreenShot"
webscreenshot_file=$(zenity --file-selection --title "WebScreenShot" --text "Select File of URLs")
mkdir ~/Documents/webscreenshot
cd ~/Documents/webscreenshot
webscreenshot -q 100 -i $webscreenshot_file
open ~/Documents/webscreenshot
exit;;
esac
done